import { ensureUser } from '../../middleware/validators'
import * as terms from './controller'

export const baseUrl = '/terms'

export default [
  {
    method: 'POST',
    route: '/',
    handlers: [
      ensureUser,
      terms.createTerm
    ]
  },
  {
    method: 'GET',
    route: '/',
    handlers: [
      ensureUser,
      terms.getTerms
    ]
  },
  {
    method: 'GET',
    route: '/:id',
    handlers: [
      ensureUser,
      terms.getTerm
    ]
  },
  {
    method: 'PUT',
    route: '/:id',
    handlers: [
      ensureUser,
      terms.getTerm,
      terms.updateTerm
    ]
  },
  {
    method: 'DELETE',
    route: '/:id',
    handlers: [
      ensureUser,
      terms.getTerm,
      terms.deleteTerm
    ]
  }
]
